package com.dmgn.action;

import java.util.ArrayList;
import java.util.List;

import com.dmgn.bean.Label;
import com.dmgn.bean.RequestParam;
import com.dmgn.bean.ResponseParam;
import com.dmgn.service.ILabelService;
import com.dmgn.serviceimpl.LabelServiceImpl;
import com.dmgn.util.BaseAction;



public class LabelAction extends BaseAction{

	/**
	 * @Fields serialVersionUID : TODO
	 */
	private static final long serialVersionUID = 1L;
	
	
	private Label label;
	private RequestParam requestParam;
	private ResponseParam responseParam;
	
	private List<Label> labelList = new ArrayList<Label>();
	
	private ILabelService labelService;
		
	public LabelAction(){
		labelService = new LabelServiceImpl();
	}

	
	
	/**
	 * 获取标签
	 * 
	 * @return
	 */
	public String getLableList(){
//		label = new Label();
		labelList = labelService.findLabel(requestParam.getType());
//		responseParam = new ResponseParam();
//		responseParam.setTotalNum(labelService.getTotalNum(requestParam.getQueryStr(), label));
		return SUCCESS;
	}
	
	
	
	/**
	 * 添加标签
	 * 
	 * @return
	 */
	public String addLabel(){
		responseParam = new ResponseParam();
		if(labelService.addLabel(label)){		
			responseParam.setMessage("添加标签成功");
			return SUCCESS;	
		}
		else{
			responseParam.setMessage("添加标签失败");
			return ERROR;		
		}
		
	}


	public Label getLabel() {
		return label;
	}

	public void setLabel(Label label) {
		this.label = label;
	}

	public RequestParam getRequestParam() {
		return requestParam;
	}

	public void setRequestParam(RequestParam requestParam) {
		this.requestParam = requestParam;
	}

	public ResponseParam getResponseParam() {
		return responseParam;
	}

	public void setResponseParam(ResponseParam responseParam) {
		this.responseParam = responseParam;
	}

	public List<Label> getLabelList() {
		return labelList;
	}

	public void setLabelList(List<Label> labelList) {
		this.labelList = labelList;
	}
	
}




